package com.cskaoyan.javase.oop2._1extends._5protected._2example;

import com.cskaoyan.javase.oop2._1extends._5protected._2example.test.TestFather;

/**
 * 受保护访问权限举例
 * @since 15:05
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo extends TestFather{
    public static void main(String[] args) {
        Father f = new Father();
        f.test();

        Son2 s2 = new Son2();
        // 'testProtected()' has protected access in 'com.cskaoyan.javase.oop2._1extends._5protected._2example.test.TestFather'
        // s2.testProtected();

        Demo demo = new Demo();
        demo.testProtected();

    }
}
class Father{
    protected void test(){
        System.out.println("受保护的方法");
    }
}
class Son extends Father{

}
class Son2 extends TestFather{
    // 静态方法
    public static void testStatic(){
        Son2 s = new Son2();
        s.testProtected();
    }
    // 成员方法
    public void test(){
        testProtected();
    }
}